package com.jintoufs.dao.sys.impl;

import com.jintoufs.dao.MyBatisSupport;
import com.jintoufs.dao.QueryFilters;
import com.jintoufs.dao.sys.MessageDAO;
import com.jintoufs.domain.sys.Message;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 数据字典
 */
@Repository
public class MessageDAOImpl extends MyBatisSupport<MessageDAO, Message> implements MessageDAO {
    @SuppressWarnings("serial")
    private static Map<String, Object> fildMap = new HashMap<String, Object>() {
        {
            put("id", "id");
            put("title", "title");
            put("status", "status");
        }
    };

    @Override
    public Integer update(Message entity) {
        return getMapper().update(entity);
    }

    @Override
    public Integer insert(Message entity) {
        return getMapper().insert(entity);
    }

    @Override
    public void delete(Integer id) {
        getMapper().delete(id);
    }

    @Override
    public List<Message> getByFilter(QueryFilters filters) {
        filters.format(fildMap);
        return getMapper().getByFilter(filters);
    }

    @Override
    public List<Message> getByParams(Map<String, Object> params1) {
        return getMapper().getByParams(params1);
    }

}
